package stc.skymobi.bean.esb.core;

import java.util.ArrayList;
import java.util.Arrays;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;


// in m2a header
//+-+-+-+-+-+-+-+
//|condCount(1) |
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ >-----+
//| condIndex(2)                |   condDataLen(2)                |       | 
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+       +->  数量为condCount
//|                         condData[condDataLen]......           |       |
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ >-----+

/**
 * E2A的广播消息适配规则
 * @author Bluces.Wang@sky-mobi.com
 */

public class TerminalBroadCastRule {
	public static final short SET_BRDCAST_COND_OPER_REPLACE = 0;
	public static final short SET_BRDCAST_COND_OPER_ADD = 1;

	private short condCount;
	private	ArrayList<Condition> conds;
	
	/**
	 * 条件
	 */
	public static class Condition{
		private int condIndex; 
		//private int condDataLen;
		private byte[] condData;
		@Override
		public String toString() {
			return "Condition [condIndex=" + condIndex + ", condData="+ Arrays.toString(condData) + "]";
		}
		public int getCondIndex() {
			return condIndex;
		}
		public void setCondIndex(int condIndex) {
			this.condIndex = condIndex;
		}
		public byte[] getCondData() {
			return condData;
		}
		public void setCondData(byte[] condData) {
			this.condData = condData;
		}
	}
    
    public String toString() {
        return  ToStringBuilder.reflectionToString(this, 
                            ToStringStyle.SHORT_PREFIX_STYLE);
    }

	public short getCondCount() {
		return condCount;
	}

	public void setCondCount(short condCount) {
		this.condCount = condCount;
	}

	public ArrayList<Condition> getConds() {
		return conds;
	}

	public void setConds(ArrayList<Condition> conds) {
		this.conds = conds;
	}

}
